﻿<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
             x:Class="OrbitOne.CRMLyncInfoDashboard.Shell.SummaryView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    
    mc:Ignorable="d"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cal="http://www.caliburnproject.org" xmlns:Views="clr-namespace:OrbitOne.CRMLyncInfoDashboard.Shell.Views"
             xmlns:windowsToolbar="clr-namespace:Windows.Toolbar.Controls;assembly=Windows.Toolbar"
             d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Common.xaml" />
                <ResourceDictionary Source="Resources/SummaryViewResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </UserControl.Resources>

    <toolkit:BusyIndicator BusyContent="Please wait..." IsBusy="{Binding IsBusy}" 
                               HorizontalAlignment="Stretch" 
                               HorizontalContentAlignment="Stretch">
        <toolkit:DockPanel VerticalAlignment="Stretch">

            <toolkit:ContextMenuService.ContextMenu>
                <toolkit:ContextMenu>
                    <toolkit:MenuItem Header="Refresh" cal:Message.Attach="[Event Click] = [Action RefreshContents()]" />
                </toolkit:ContextMenu>
            </toolkit:ContextMenuService.ContextMenu>

            <Border Style="{StaticResource MenuBorderStyle}"  
                toolkit:DockPanel.Dock="Top">
                <Border.Effect>
                    <DropShadowEffect Color="Gray" BlurRadius="5" Direction="275"/>
                </Border.Effect>

                <StackPanel Orientation="Horizontal" Height="71">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <windowsToolbar:ToolbarButton
                                          Style="{StaticResource ToolbarButtonStyle}"
                                          Grid.Column="0"
                                          cal:Message.Attach="NewAccount()">
                            <StackPanel>
                                <Image Source="../Images/ico_fhe_1.png" Height="32" Width="32"/>

                                <StackPanel Orientation="Vertical">
                                    <TextBlock Foreground="Black" Text="New" HorizontalAlignment="Center" Height="12" VerticalAlignment="Bottom"/>
                                    <TextBlock Foreground="Black" Text="Account" HorizontalAlignment="Center" VerticalAlignment="Top" Height="13"/>
                                </StackPanel>
                            </StackPanel>
                        </windowsToolbar:ToolbarButton>
                        <windowsToolbar:ToolbarButton
                                          Style="{StaticResource ToolbarButtonStyle}"
                                          Grid.Column="1"
                                          cal:Message.Attach="NewContact()">
                            <StackPanel>
                                <Image Source="../Images/ico_fhe_2.png" Height="32" Width="32"/>

                                <StackPanel Orientation="Vertical">
                                    <TextBlock Foreground="Black" Text="New" HorizontalAlignment="Center" Height="12" VerticalAlignment="Bottom"/>
                                    <TextBlock Foreground="Black" Text="Contact" HorizontalAlignment="Center" VerticalAlignment="Top" Height="13"/>
                                </StackPanel>
                            </StackPanel>
                        </windowsToolbar:ToolbarButton>
                        <windowsToolbar:ToolbarButton
                                          Style="{StaticResource ToolbarButtonStyle}"
                                          Grid.Column="2"
                                          cal:Message.Attach="NewLead()">
                            <StackPanel>
                                <Image Source="../Images/ico_fhe_4.png" Height="32" Width="32"/>

                                <StackPanel Orientation="Vertical">
                                    <TextBlock Foreground="Black" Text="New" HorizontalAlignment="Center" Height="12" VerticalAlignment="Bottom"/>
                                    <TextBlock Foreground="Black" Text="Lead" HorizontalAlignment="Center" VerticalAlignment="Top" Height="13"/>
                                </StackPanel>
                            </StackPanel>
                        </windowsToolbar:ToolbarButton>
                    </Grid>
                    <!--</windowsToolbar:ToolbarGroup>-->

                </StackPanel>
            </Border>

            <Border Style="{StaticResource OuterBorderStyle}">
                <Border Style="{StaticResource ContentBorderStyle}">
                    <toolkit:DockPanel  Style="{StaticResource DockPanelStyle}">
                        <toolkit:Accordion ItemsSource ="{Binding Path=EntityCategories}"
                                                  Style="{StaticResource AccordionStyle}"
                                                   Grid.Row="1"
                                           toolkit:DockPanel.Dock="Top">
                            <toolkit:Accordion.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding Path=Header.Text}" 
                                                   Style="{StaticResource AccordionHeaderStyle}"/>
                                    </StackPanel>
                                </DataTemplate>

                            </toolkit:Accordion.ItemTemplate>

                            <toolkit:Accordion.ContentTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical">
                                        <Border Style="{StaticResource GridHeaderBorderStyle}">
                                            <ItemsControl ItemsSource ="{Binding GridHeaderLabels}">
                                                <ItemsControl.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel Style="{StaticResource HeaderItemsPanelStackPanelStyle}" />
                                                    </ItemsPanelTemplate>
                                                </ItemsControl.ItemsPanel>
                                                <ItemsControl.ItemTemplate>
                                                    <DataTemplate>
                                                        <Border Style="{StaticResource GridHeaderTextBlockBorderStyle}">
                                                            <TextBlock Width="{Binding Width}" Text="{Binding Text}" Style="{StaticResource GridHeaderTextBlockStyle}"/>
                                                        </Border>
                                                    </DataTemplate>
                                                </ItemsControl.ItemTemplate>
                                            </ItemsControl>
                                        </Border>
                                        <ListBox  ItemsSource="{Binding SavedQueryDisplayItems}" 
                                                  Style="{StaticResource ListBoxStyle}"
                                                   ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <StackPanel Style="{StaticResource ItemsPanelStackPanelStyle}">
                                                        <Image Source="{Binding PictureLocation}" Style="{StaticResource RowPictureStyle}"/>
                                                        <HyperlinkButton cal:Message.Attach="EntitySelected(DisplayItem.DataContext.ParentEntityModel)"
                                                                                         Style="{StaticResource HyperlinkStyle}">
                                                            <ItemsControl x:Name="DisplayItem" ItemsSource="{Binding Values}">
                                                                <ItemsControl.ItemsPanel>
                                                                    <ItemsPanelTemplate>
                                                                        <StackPanel Style="{StaticResource ItemsPanelStackPanelStyle}" />
                                                                    </ItemsPanelTemplate>
                                                                </ItemsControl.ItemsPanel>
                                                                <ItemsControl.ItemTemplate>
                                                                    <DataTemplate>
                                                                        <Border Style="{StaticResource GridTextBlockBorderStyle}">

                                                                            <TextBlock Width="{Binding Width}" Text="{Binding Text}" Style="{StaticResource GridTextBlockStyle}"/>

                                                                        </Border>
                                                                    </DataTemplate>
                                                                </ItemsControl.ItemTemplate>
                                                            </ItemsControl>
                                                        </HyperlinkButton>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>

                                        </ListBox>
                                    </StackPanel>
                                </DataTemplate>

                            </toolkit:Accordion.ContentTemplate>
                        </toolkit:Accordion>

                        <!-- <ListBox Name="Messages" HorizontalAlignment="Stretch" 
                                         HorizontalContentAlignment="Stretch"
                                         Grid.Row="2">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding Uri}" HorizontalAlignment="Stretch"/>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>

                                        <ListBox Name="EntityMetadata" HorizontalAlignment="Stretch" 
                                         HorizontalContentAlignment="Stretch"
                                         Grid.Row="2">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding SchemaName}" HorizontalAlignment="Stretch"/>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>-->
                        
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" 
                                    toolkit:DockPanel.Dock="Bottom" 
                                    Style="{StaticResource StackPanelStyle}" 
                                    HorizontalAlignment="Center">
                            <Border Style="{StaticResource LogoBorderStyle}">
                                <Image Source="../Images/logo_only_orbit_240_black_gif.png" Height="60"/>
                            </Border>
                        </StackPanel>

                    </toolkit:DockPanel>
                </Border>
            </Border>           
        </toolkit:DockPanel>
    </toolkit:BusyIndicator>

</UserControl>
